# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Dan McGee <dan@archlinux.org>
# Contributor: Michael Irwin <6d6469@gmail.com>

pkgname=memcached
pkgver=1.5.10
pkgrel=1
pkgdesc='Distributed memory object caching system'
url='https://memcached.org/'
arch=('x86_64')
license=('GPL')
depends=('libevent' 'libseccomp')
optdepends=('perl: for memcached-tool usage')
source=(https://www.memcached.org/files/${pkgname}-${pkgver}.tar.gz
        memcached.service
        memcached.tmpfiles
        memcached.sysusers)
sha256sums=('494c060dbd96d546c74ab85a3cc3984d009b4423767ac33e05dd2340c01f1c4b'
            'fd60fde92b959dc4160facc0d165f04319d2ece4d2c59b68d8ae24824abea7dd'
            'c4d0ae2218b99a276ff6e0084ae81e66add0ca9347e4bde70e9172db6e44002a'
            '228c4f536f3c9f9eee4e11226ec8846a22d4ba46c2d3bf2811413efcc322609a')
sha512sums=('5b6217ab90492cb4b3f6597c935a4028697f1d071516d647a70f6ba9353db16184ef229935733e669d4120d34d72f6f2415edcfd3ec899e06eab9d3f494f11f1'
            '5b006064b3ab31a6982f5c7b1ab4a49d64118a459913bd4be18ca63bf606dcae3550121d05a34ac8932d28b367e18fa76699c46e311b0b6a22f36ab1885ebebe'
            '960705ff74d25afed477e0b2a5872a3a4fb49ed3105a351f0d0224abc947778f9dbda81e80be94ab636da4a8411a9dd56a8fd4513e5b86a3096a14fa67f1548b'
            'e6ddcab9a6fee024072b6363ef60aa176ed258369bf3a17d475f19b1f410ffd6195b9c5737dc5b1371e8974b44bdbdaa109927acaeb54fb40302a5d67d7c13a8')

prepare() {
  cd ${pkgname}-${pkgver}
  sed -e 's/^##safer##//g' -i scripts/memcached.service scripts/memcached@.service
}

build() {
  cd ${pkgname}-${pkgver}
  ./configure \
    --prefix=/usr \
    --enable-seccomp
  make
}

check() {
  cd ${pkgname}-${pkgver}
  make test
}

package() {
  cd ${pkgname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -Dm 755 scripts/memcached-tool -t "${pkgdir}/usr/bin"
  install -Dm 644 ../memcached.service -t "${pkgdir}/usr/lib/systemd/system"
  install -Dm 644 ../memcached.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/memcached.conf"
  install -Dm 644 ../memcached.sysusers "${pkgdir}/usr/lib/sysusers.d/memcached.conf"
}

# vim: ts=2 sw=2 et:
